<html>
<head>
	<script type="text/javascript">
		var aJaxURL	= "server-side/report/profit_loss.action.php";		//server side folder url
		var tName	= "report";												//table name
		
		$(document).ready(function () {        	
			LoadTable(0);
			GetDate("search_start");
			GetDate("search_end");
		});
        
		function LoadTable(start, end){
			var total = [2,3,4];
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
			GetProfitDataTable(tName, aJaxURL, "get_list", 6, "start=" + start + "&end=" + end, 0, "", 1, "desc", total);
			$(".search_init").css("width", "90%");
		}
		
	    $(document).on("change", "#search_start", function () {
	    	var start	= $(this).val();
	    	var end		= $("#search_end").val();
	    	LoadTable(start, end);
	    });
	    
	    $(document).on("change", "#search_end", function () {
	    	var start	= $("#search_start").val();
	    	var end		= $(this).val();
	    	LoadTable(start, end);
	    });
	    
    </script>
</head>

<body>    
    <div id="dt_example" class="ex_highlight_row">
        <div id="container" style="width: 98%;">
            <div id="dynamic">
            	<h2 align="center">მოგება–ზარალი</h2>
            	<div id="button_area">
	            	<div class="left" style="width: 250px;">
	            		<label for="search_start" class="left" style="margin: 5px 0 0 9px;">დასაწყისი</label>
	            		<input type="text" name="search_start" id="search_start" class="inpt right"/>
	            	</div>
	            	<div class="right" style="width: 256px;">
	            		<label for="search_end" class="left" style="margin:5px 0 0 3px">დასასრული</label>
	            		<input type="text" name="search_end" id="search_end" class="inpt right" />
            		</div>
            	</div>
                <table class="display" id="report">
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 100%;">პროდუქციის დასახელება </th>                                                                           
                            <th style="width: 180px;">შემოსავალი რეალიზაციიდან </th>
                            <th style="width: 120px; font-size: 8pt !important;"><pre>თვითღირებულება</pre></th>
                            <th style="width: 100px; font-size: 8pt !important;">მოგება</th>
                            <th style="width: 150px; font-size: 8pt !important;">მარჟა</th>                          
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            	<input type="text" name="search_name" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                            	<input type="text" name="search_name" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" id="search_profit_realise" name="search_barcode" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" id="search_name_self_cost" name="search_name" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" id="search_profit" name="search_ert" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" id="search_marja" name="search_self_quantity" value="ფილტრი" class="search_init" />
                            </th>                                                      
                        </tr>
                    </thead>                    
                    <tfoot>
                        <tr>
                            <th>&nbsp;</th>
                             <th style="padding: 0px 0px 0px 0px;"><p align="right">ჯამი:<br/>სულ ჯამი:</th> 
                            <th>&nbsp;</th>
                            <th id="self_cost">&nbsp;</th>
                            <th id="profit">&nbsp;</th>                            
                            <th><div id="marja"></div><div id="sum_marja"></div></th>
                        </tr>
                    </tfoot>
                </table>
            </div>
            <div class="spacer">
            </div>
        </div>
    </div>
</body>
</html>